<template>
  <div>
    <transition name="el-zoom-in-center">
      <div v-show="show" class="transition-box" :style="{ top: top + 'rem', left: left + 'rem', right: right + 'rem' }">
        <el-card class="box-card">
          <div slot="header" class="head-title" @click="close()">
            <i class="el-icon-arrow-left"></i>
            <span>{{title}}</span>
          </div>
          <div class="main">
            <div class="inner-box">
              <slot></slot>
            </div>
            <div class="d-footer" v-if="showBtn">
              <el-button @click="close()" class="el-button">取 消</el-button>
              <el-button  @click="confirm()" type="primary" class="el-button">{{btnText}}</el-button>
              <slot name="footer"></slot>
            </div>
          </div>
        </el-card>
      </div>
    </transition>
  </div>
</template>

<script>

export default {
  name:'zl-detail',
  props: {
    show:{
      type: Boolean,
      default: false,
    },
    title:{
      type: String,
      default: '详细',
    },
    btnText:{
      type: String,
      default: '确 认',
    },
    showBtn:{
      type: Boolean,
      default: true,
    },
    top: {
      type: Number,
      default: 3,
    },
    left: {
      type: Number,
      default: 0.65,
    },
    right: {
      type: Number,
      default: 0.65,
    },
  },
  data() {
    return {

    }
  },

  methods: {
    close(){
      this.$emit('close')
    },
    confirm(){
      this.$emit('confirm')
    }
  },
};
</script>



<style scoped lang="scss">

/* 去除全屏蒙版 */
.el-image-viewer__mask {
  display: none;
}

/* 去除上方小蒙版 */
.el-image-viewer__btn {
  display: none;
}

.transition-box {
  position: absolute;
  left: 10px;
  right: 10px;
  height: calc(100vh - 130px);
  border-radius: 4px;
  color: #fff;
  background-color: #ffffff;
  z-index: 90;
}

.box-card {
  position: relative;
  .head-title {
    cursor: pointer;
  }

  .main {
    height: calc(100vh - 200px);

    .inner-box {
      height: calc(100% - 60px);
      overflow-y: auto;
    }

    .title {
      height: 40px;
      font-weight: 600;
    }

    .d-footer {
      position: absolute;
      left: 0;
      right: 0;
      bottom: 14px;
      padding: 10px 0;
      border-top: 1px #e5e5e5 solid;
      text-align: center;
      background-color: #fff;
      z-index: 4;
      .el-button{
        margin: 0 20px;
      }
    }
  }
}
</style>
